# coding=utf-8
import os


def listDir(_filename, _path, _files):
    if os.path.isfile(_path):
        printPath(_filename, _path, _files)
        return
    for file in os.listdir(_path):
        if os.path.isfile("%s/%s" % (_path, file)):
            printPath(file, "%s/%s" % (_path, file), _files)
            continue
        for f in os.listdir("%s/%s" % (_path, file)):
            listDir(f, "%s/%s/%s" % (_path, file, f), _files)
    pass


def printPath(_filename, _path, _files):
    _files.append({"name": _filename, "path": _path})
    pass

